import 'package:core_ui/base/page_state.dart';
import 'package:get/get.dart';

class BaseLogic extends GetxController {
  final _pageState = PageState().obs;

  get pageState => _pageState;

  @override
  void onInit() {
    super.onInit();
    _pageState.value = LoadingState();
  }

  //===Desc:=====================================================================================
  void loading() => _pageState.value = LoadingState();

  void success() => _pageState.value = SuccessState();

  void empty(int code, {String msg = ""}) =>
      _pageState.value = EmptyState(code, msg);

  void error(int code, {String msg = ""}) =>
      _pageState.value = ErrorState(code, msg);
}
